#!/bin/python3
#-*- coding: utf-8 -*-
# map__.py
# @author 刘秋
# @email lq@aqiu.info
# @description
# @created 2020-05-11T16:12:13.117Z+08:00
# @last-modified 2020-05-11T17:23:09.932Z+08:00
#

import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
data = pd.DataFrame({
    'food': [
        'bacon', 'pulled pork', 'bacon', 'Pastrami', 'corned beef', 'Bacon',
        'pastrami', 'honey ham', 'nova lox'
    ],
    'ounces': [4, 3, 12, 6, 7.5, 8, 3, 5, 6]
})
# print(data)
meat_to_animal = {
    'bacon': 'pig',
    'pulled pork': 'pig',
    'pastrami': 'cow',
    'corned beef': 'cow',
    'honey ham': 'pig',
    'nova lox': 'salmon'
}

lowercased = data['food'].str.lower()
data['animal'] = lowercased.map(meat_to_animal)
# print(data)

data['animal1'] = data['food'].map(lambda x: meat_to_animal[x.lower()])
# print(data)


data.index = list('abcdefghi')
data.index = data.index.map(lambda x: x.upper())
print(data)